---
title: Get a prediction server ID
dataset_name: N/A
description: Learn how to retrieve a prediction server ID using cURL commands from the REST API or by using the DataRobot Python client.
domain: DSX
expiration_date: 6-20-2022
owner: nathan.goudreault@datarobot.com
url: docs.datarobot.com/en/tutorials/using-the-api/pred-server-id.html
---

# Get a prediction server ID {: #get-a-prediction-server-id }

In order to make predictions from a deployment via DataRobot's [Prediction API](dr-predapi), you need a prediction server ID. In this tutorial, you'll learn how to retrieve the ID using cURL commands from the REST API or by using the DataRobot Python client. Once obtained, you can use the prediction server ID to deploy a model and make predictions.

!!! note
    Before proceeding, note that an API key is required for this tutorial. Reference the [Create API keys](api-key-mgmt) tutorial for more information.

=== "cURL"

    ``` shell
    curl -v \
    -H "Authorization: Bearer API_KEY" \ YOUR_DR_URL/api/v2/predictionServers/

    Example
    API_KEY=YOUR_API_KEY
    ENDPOINT=YOUR_DR_URL/api/v2/predictionServers/

    curl -v \
    -H "Authorization: Bearer $API_KEY" \
    $ENDPOINT
    ```

=== "Python"

    Before continuing with Python, be sure you have installed the DataRobot Python client and configured your connection to DataRobot as outlined in the [API quickstart guide](api-quickstart/index).

    ``` python
    # Set up your environment
    import os
    import datarobot as dr

    API_KEY = os.environ["API_KEY"]
    YOUR_DR_URL = os.environ["YOUR_DR_URL"]
    FILE_PATH = os.environ["FILE_PATH"]
    ENDPOINT = YOUR_DR_URL+"/api/v2"

    # Instantiate DataRobot instance
    dr.Client(
        token=API_KEY,
        endpoint=ENDPOINT
    )

    prediction_server_id = dr.PredictionServer.list()[0].id
    print(prediction_server_id)
    ```


## Documentation {: #documentation }

The following provides additional documentation for features mentioned in this tutorial.

* [API key management](api-key-mgmt#api-key-management)
* [DataRobot Developers portal](https://developers.datarobot.com/){ target=_blank }
* [DataRobot Prediction API](dr-predapi)
